package com.frogs.ucenter.v1.request;

import javax.servlet.http.HttpServletRequest;

import com.frogs.framework.web.HttpRequestInfo;
import com.frogs.system.util.ApiUrlParamEnum;
import com.frogs.system.web.api.request.Request;
import com.frogs.system.web.exception.RequestIllegalException;

public class UserFamilyMemberListRequest extends Request {
	
	private static final long serialVersionUID = -210351842829530996L;

	private int pageNum ; 
	
	private int numPerPage ;
	
	private int userId ;

	/** */
	public UserFamilyMemberListRequest() {
	}

	@Override
	public void parse(HttpServletRequest request) {
		
		HttpRequestInfo requestInfo = new HttpRequestInfo(request);
		
		this.pageNum = requestInfo.getIntParameter(ApiUrlParamEnum.pageNo.getParamName());
		this.numPerPage = requestInfo.getIntParameter(ApiUrlParamEnum.pageSize.getParamName());
		this.userId = requestInfo.getIntParameter(ApiUrlParamEnum.userId.getParamName());
		
		if ( pageNum <1) {
			this.pageNum = 1;
		}
		
		if( userId < 0) {
			throw new RequestIllegalException("error userId:"+userId);
		}
		
		if(numPerPage <1){
			this.numPerPage = 200;//需求要求默认只返回200
		}
	}
	
	public int getPageNum() {
		return pageNum;
	}
	
	public void setPageNum(int pageNum) {
		this.pageNum = pageNum;
	}
	
	public int getNumPerPage() {
		return numPerPage;
	}
	
	public void setNumPerPage(int numPerPage) {
		this.numPerPage = numPerPage;
	}
	
	public int getUserId() {
		return userId;
	}
	
	public void setUserId(int userId) {
		this.userId = userId;
	}

	
	
}
